package cn.shengchao.examstar.gankao.acl.ports.repositories;

import cn.shengchao.examstar.gankao.infrastrure.po.*;
import cn.shengchao.examstar.rpc.gankao.GanKaoOrderGoodsListDto;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @program: examstarapi
 * @description: 赶考网对接业务处理
 * @author: Xiong weiqiang
 * @create: 2025-06-23 17:29
 */
public interface IGanKaoRepository {
    Long getMaxFinishLoadVersion();
    void createLoadVersion(Long loadVersion);

    GkSyncTask findNeedLoadTask();

    GkSyncTask findNeedLoadDetailTask();
    void saveBatchGrade(List<GkGrade> gkGradeList);

    void saveBatchSubject(List<GkSubject> gkSubjectList);

    void saveBatchGradeSubject(List<GkGradeSubject> gradeSubjectList);

    void saveBatchCourse(List<GkCourse> gkCourses);

    void finishDataLoadTaskByLoadVersion(Long loadVersion);
    void finishSpecialLoadTaskByLoadVersion(Long loadVersion);
    void finishCourseDetailLoadTaskByLoadVersion(Long loadVersion);

    List<GkCourse> loadNotLoadDetailCourse(Long loadVersion);

    List<GkCourse> loadNotLoadDetailCourseInSpecialTag(Long loadVersion,String tag);
    void saveBatchLesson(List<Long> courseDataIds,List<GkLesson> lessons,List<GkSection> sections);

    void saveBatchCourseCategoryByCheck(Long loadVersion, int gradeId, int subjectId, List<GkSubjectCategory> gkSubjectCategories);

    List<GkGradeSubject> listAllGradeSubjects();

    List<GkGrade> listAllGrades();

    List<GkSubject> listAllSubjects();

    List<GkSubjectCategory> listSubjectCategorys(String number, Integer gradeId, Integer subjectId);

    void saveGradeSpecMatch(Integer gradeId,Long specId) ;

    void saveSubjectSpecMatch(Integer gradeId, Integer subjectId, Long specTypeId);

    void saveSubjectCateSpecMatch(Integer gradeId, Integer subjectId, Integer cateId,Integer parentId, Long id);

    List<GkCourse> loadCourseTypeNotSyncLocalCourse(String loadVersion, int courseType, int lastLimit);

    List<GkCourse> loadCourseTagNotSyncLocalCourse(String string, String tag, int lastLimit);
    List<GkCourse> loadCourseTypeNotSpecCourse(String loadVersion,int courseType,int lastLimit);
    void updateCourseSyncStatusAndDetail(Long loadVersion, List<Integer> courseIds);
    List<GkCourse> loadAllCourse(Long loadVersion);

    List<GkLesson> loadSessionByCourseId(Long loadVersion, Integer id);

    List<GkSection> loadSectionByCourseIdAndLesson(Long loadVersion, Integer id, Integer lessonId);

    List<GkSpecTypeMatch> listSpecificationTypeIdByCateId(Integer cateId);

    boolean checkOrderCourseAndSync(String orderId, Date orderTime, BigDecimal amount, Long userId, List<GanKaoOrderGoodsListDto> goodsListDtoList);

    void loadAndRefreshUserCourseExpired(Long id);

    void saveBatchSpecTagCourse(List<GkSpecialTagCourse> gkSpecialTagCourses);

    void saveBatchCourseCategoryCourseTypeTag(List<GkSubjectCategoryCourseTypeTag> gkSubjectCategoryCourseTypeTagList);

    void updateCourseLoadStatusAndDetail(Long loadVersion, Map<Integer, String> courseDetailMap);

    String findSpecTypeIdForCourseTag(String tag);

    List<GkCourse> selectCourseByCourseIds(Long loadVersion, List<Integer> courseIds);

    List<GkCourse> localCourseNeedCreateSpec(Long loadVersion,int limit);

    List<String> findLocalSpecTypeIdsFromTagMatchForGanKaoCourseId(Integer ganKaoCourseId);

    List<String> findLocalSpecTypeIdsFromSubjectMatchForGanKaoCourseId(Integer ganKaoCourseId);

    void updateCourseSpecStatus(Long loadVersion, Integer courseId);
}